package com.hm.util;

import java.io.Serializable;
import java.util.Map;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.PropertySource;

@Configuration
@ImportResource("classpath:util/app.cfg.xml")
//@PropertySources({@PropertySource("")})
@PropertySource("classpath:util/db.properties")
@ComponentScan
public class CollectinDemo {

	public static void main(String[] args) {
		ApplicationContext ac = new AnnotationConfigApplicationContext(CollectinDemo.class);
		Man man = ac.getBean(Man.class);
		System.out.println(man);
		
		Map map = (Map) ac.getBean("dsz");
		System.out.println(map);
		
		System.out.println(ac.getBean("dataBase"));
		
		Serializable bean = ac.getBean(Serializable.class);
		Serializable bean2 = ac.getBean(Serializable.class);

		System.out.println(bean==bean2);
		
	}

}
